import router from "@/router"
import $axios from "@/utils/http"

/**
 * 用户登录
 */
export async function wxLogin(data) {
  // 请求方式要用data进行指定
  const response = await $axios.post('/dev-api/wx/login', data );
  return response;
}
export async function bookList(data) {
  // 请求方式要用data进行指定
  const response = await $axios.post('/dev-api/calendar/list', data );
  return response;
}
/**
 * 增加
 * @param {*} data   添加的数据
 */
export async function bookInsert(data) {
  // 请求方式要用data进行指定
  const response = await $axios.post('/dev-api/calendar/add', data);
  return response;
}
export function parseStrEmpty(str) {
  if (!str || str == "undefined" || str == "null") {
    return "";
  }
  return str;
}
export async function bookDetails(data) {
  let data1=parseStrEmpty(data)
  // 请求方式要用data进行指定
  const response = await $axios.get(`/dev-api/calendar/details/${data1}`);
  return response;
}
export async function bookdelete(data) {
  let data1=parseStrEmpty(data)
  // 请求方式要用data进行指定
  const response = await $axios.delete(`/dev-api/calendar/delete/${data1}` );
  return response;
}
